﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Globalization;

namespace CMSN.Software.Tutorials.HowToUseCustomPagination
{
    public sealed class SampleData
    {
        /// <summary>
        /// Prevents a default instance of the <see cref="SampleData"/> class from being created.
        /// </summary>
        private SampleData() { }

        public static Dictionary<string, string> SampleDataList(int startIndex, int pageSize)
        {
            Dictionary<string, string> sampleTable = new Dictionary<string, string>();
            var query = from p in TemporaryData()
                        .Take(pageSize)
                        .Skip(startIndex)
                        select new
                        {
                            FirstColumn = p.Key,
                            SecondColumn = p.Value
                        };
            foreach (var row in query)
            {
                sampleTable.Add(row.FirstColumn, row.SecondColumn);
            }
            return sampleTable;
        }

        public static Dictionary<string,string> TemporaryData()
        {
            Dictionary<string, string> sampleDataSet = new Dictionary<string, string>();
            for (int i = 1; i <= 49; i++)
            {
                sampleDataSet.Add("Raw " + i + " Cell 1", "Raw " + i + " Cell 2");
            }

            return sampleDataSet;
        }
    }
}